package de.baumann.browser.present.explore

import de.baumann.browser.api.OdinObserver
import de.baumann.browser.api.net.vo.explore.OdinDestroyBean
import de.baumann.browser.api.net.vo.explore.OtherDestroyBean
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.iview.explore.IOdinDestroyRecordView
import de.baumann.browser.model.ExploreApiMode
import de.baumann.browser.model.UserModel
import de.baumann.browser.model.getAddress
import de.baumann.browser.utils.getMoneyAddress

class OdinDestroyPresenter : BasePresenter<IOdinDestroyRecordView>() {
    fun getOdinDestroyList() {
        var moneyAddress = getMoneyAddress()
        if (moneyAddress?.startsWith("0x") == true) {
            moneyAddress = "od" + moneyAddress?.substring(1)
        }
        ExploreApiMode()
                .getExploreOdinDestroy(moneyAddress!!, "2021-07-01", "2021-07-26")
                .subscribe(object : OdinObserver<List<OdinDestroyBean>>() {
                    override fun onSuccess(data: List<OdinDestroyBean>) {
                        view?.getOdinDestroy(data)
                    }
                })
    }

}